package com.epam.ws.anatomist.example.message;

import java.util.Properties;

import com.epam.ws.anatomist.common.WsAnatomistUtil;
import com.epam.ws.anatomist.message.MessageBuilder;
import com.epam.ws.anatomist.message.TemplateEntity;

public class TemplateProcessor
{

	public static <T> T createRequest(TemplateEntity templateEntity, Class<T> requestType)
	{
		return MessageBuilder.buildPojoEntity(requestType, templateEntity);
	}

	public static String createSoapRequest(TemplateEntity templateEntity)
	{
		return MessageBuilder.buildXmlMessage(templateEntity);
	}

	public static String createXmlRequest(String xmlFile)
	{
		return MessageBuilder.buildXmlMessage(xmlFile);
	}

	public static TemplateEntity byTemplate(String templatePath)
	{
		TemplateEntity entity = new TemplateEntity();
		entity.setTemplatePath(templatePath);
		return entity;
	}

	public static Properties from(String propertiesPath)
	{
		return WsAnatomistUtil.loadProperties(propertiesPath);
	}

}
